package com.shrct.businessprocess.common

class Container {
	def static put(Double value){
		new Container(value)
	}
	new(Double value){
		this.value = value
		this.remain = value
	}

	Double value
	Double remain
	
	def getRemain(){
		remain
	}
	def take(Double toTake){
		val actualTake = if(remain<=toTake) remain else toTake
		remain = remain - actualTake
		actualTake
	}
	
	def taked(){
		value - remain
	}
	def takeIncremental(Double toTake){
		val actualTake = toTake - taked
		take(actualTake)
	}
	
}